SetFrontProcess
SetFrontProcess Make a process the foreground process
ProcessSerialNumber *PSN ; a pointer to a scheduled process's serial number
returns Error Code; 0=no error
You use the SetFrontProcess to schedule the specified process to become
the foreground process.
PSN is a pointer to a the process serial number of the process running in
the foreground
Returns: an operating system Error Code.
noErr (0) No error
procNotFound (-600) Process with specified process serial number does not
exist or process is suspended by high-level debugger
appIsDaemon (-606) Specified process is background-only

Notes: The specified process becomes the foreground process after the current
foreground process makes a subsequent call to WaitNextEvent or
The process serial number in the PSN parameter should be a valid process
serial number returned from LaunchApplication , GetNextProcess ,
SetFrontProcess , GetCurrentProcess , or a high-level event. You
can also use the constant kCurrentProcess to refer to the current process.
If the specified process serial number is invalid or if the specified process
is a background-only application, SetFrontProcess returns a nonzero
result code and does not change the current foreground process.
If a modal dialog box is the frontmost window, the specified process does
not become the foreground process until after the user dismisses the modal
dialog box.
Note: Do not call SetFrontProcess from a routine that executes
at interrupt time.